from openpyxl import Workbook
from openpyxl.styles import Font
from openpyxl.styles import Alignment

#                   水平对齐              垂直对齐            自动换行
align = Alignment(horizontal="center", vertical="center", wrap_text=True)
font = Font(name="宋体", size=9)

wb = Workbook()
sheet = wb['Sheet']

sheet['B1'] = '学年'
sheet['B1'].alignment = align

sheet['C1'] = '第一学年'
sheet['C1'].alignment = align

sheet['A2'] = '序号'
sheet['A2'].alignment = align
sheet.merge_cells('A2:A4')

sheet['B2'] = '年级班级'
sheet.merge_cells('B2:B4')
sheet['B2'].alignment = align

sheet['C2'] = '学生姓名'
sheet.merge_cells('C2:C4')
sheet['C2'].alignment = align

sheet['D2'] = '学籍号'
sheet.merge_cells('D2:D4')
sheet['D2'].alignment = align

sheet['E2'] = '查期'
sheet.merge_cells('E2:E4')
sheet['E2'].alignment = align

sheet['F2'] = '发育及营养状况'
sheet.merge_cells('F2:F4')
sheet['F2'].alignment = align

sheet['G2'] = '身高（cm）'
sheet.merge_cells('G2:G4')
sheet['G2'].alignment = align

sheet['H2'] = '体重（kg）'
sheet.merge_cells('H2:H4')
sheet['H2'].alignment = align

sheet['I2'] = '胸围（cm）'
sheet.merge_cells('I2:I4')
sheet['I2'].alignment = align

sheet['J2'] = '肺活量（ml）'
sheet.merge_cells('J2:J4')
sheet['J2'].alignment = align

sheet['K2'] = '血压（mmhg）'
sheet.merge_cells('K2:K4')
sheet['K2'].alignment = align

sheet['L2'] = '脉搏（次/分）'
sheet.merge_cells('L2:L4')
sheet['L2'].alignment = align

sheet['M2'] = '视力'
sheet.merge_cells('M2:R2')
sheet['M2'].alignment = align

sheet['M3'] = '左'
sheet.merge_cells('M3:O3')
sheet['M3'].alignment = align

sheet['P3'] = '右'
sheet.merge_cells('P3:R3')
sheet['P3'].alignment = align

sheet['M4'] = '裸眼视力'
sheet['M4'].alignment = align

sheet['N4'] = '矫正视力'
sheet['N4'].alignment = align

sheet['O4'] = '矫正度数'
sheet['O4'].alignment = align

sheet['P4'] = '裸眼视力'
sheet['P4'].alignment = align

sheet['Q4'] = '矫正视力'
sheet['Q4'].alignment = align

sheet['R4'] = '矫正度数'
sheet['R4'].alignment = align

sheet['S2'] = '听力'
sheet.merge_cells('S2:T2')
sheet['S2'].alignment = align

sheet['S3'] = '左'
sheet['S3'].alignment = align

sheet['T3'] = '右'
sheet['T3'].alignment = align

sheet['U2'] = '沙眼'
sheet.merge_cells('U2:U4')
sheet['U2'].alignment = align

sheet['V2'] = '色觉'
sheet.merge_cells('V2:V4')
sheet['V2'].alignment = align

sheet['W2'] = '鼻病'
sheet.merge_cells('W2:W4')
sheet['W2'].alignment = align

sheet['X2'] = '口腔'
sheet.merge_cells('X2:X4')
sheet['X2'].alignment = align

sheet['Y2'] = '心脏'
sheet.merge_cells('Y2:Y4')
sheet['Y2'].alignment = align

sheet['Z2'] = '肺'
sheet.merge_cells('Z2:Z4')
sheet['Z2'].alignment = align

sheet['AA2'] = '肝脾'
sheet.merge_cells('AA2:AA4')
sheet['AA2'].alignment = align

sheet['AB2'] = '胃肠'
sheet.merge_cells('AB2:AB4')
sheet['AB2'].alignment = align

sheet['AC2'] = '脊柱'
sheet.merge_cells('AC2:AC4')
sheet['AC2'].alignment = align

sheet['AD2'] = '四肢'
sheet.merge_cells('AD2:AD4')
sheet['AD2'].alignment = align

sheet['AE2'] = '平足'
sheet.merge_cells('AE2:AE4')
sheet['AE2'].alignment = align

sheet['AF2'] = '皮肤'
sheet.merge_cells('AF2:AF4')
sheet['AF2'].alignment = align

sheet['AG2'] = '传染病'
sheet.merge_cells('AG2:AG4')
sheet['AG2'].alignment = align

sheet['AH2'] = '胸透'
sheet.merge_cells('AH2:AH4')
sheet['AH2'].alignment = align

sheet['AI2'] = '既往病史'
sheet.merge_cells('AI2:AI4')
sheet['AI2'].alignment = align

sheet['AJ2'] = '医院名或校医名'
sheet.merge_cells('AJ2:AJ4')
sheet['AJ2'].alignment = align

sheet['AK2'] = '其他1'
sheet.merge_cells('AK2:AK4')
sheet['AK2'].alignment = align

sheet['AL2'] = '其他2'
sheet.merge_cells('AL2:AL4')
sheet['AL2'].alignment = align

sheet['AM2'] = '其他3'
sheet.merge_cells('AM2:AM4')
sheet['AM2'].alignment = align

sheet['AN2'] = '其他4'
sheet.merge_cells('AN2:AN4')
sheet['AN2'].alignment = align

sheet['AO2'] = '其他5'
sheet.merge_cells('AO2:AO4')
sheet['AO2'].alignment = align

sheet.row_dimensions[2].height = 19.5
sheet.column_dimensions['A'].width = 8.38
sheet.column_dimensions['B'].width = 11.88
sheet.column_dimensions['C'].width = 14
sheet.column_dimensions['D'].width = 20.13
sheet.column_dimensions['E'].width = 15.63
sheet.column_dimensions['F'].width = 7
sheet.column_dimensions['G'].width = 7.5
sheet.column_dimensions['H'].width = 7.5
sheet.column_dimensions['I'].width = 7.5
sheet.column_dimensions['J'].width = 7.5
sheet.column_dimensions['K'].width = 7.5
sheet.column_dimensions['L'].width = 11
sheet.column_dimensions['M'].width = 8.38
sheet.column_dimensions['N'].width = 8.38
sheet.column_dimensions['O'].width = 8.38
sheet.column_dimensions['P'].width = 8.38
sheet.column_dimensions['Q'].width = 8.38
sheet.column_dimensions['R'].width = 8.38
sheet.column_dimensions['S'].width = 8.38
sheet.column_dimensions['T'].width = 8.38
sheet.column_dimensions['U'].width = 8.38
sheet.column_dimensions['V'].width = 8.38
sheet.column_dimensions['W'].width = 8.38
sheet.column_dimensions['X'].width = 8.38
sheet.column_dimensions['Y'].width = 15.75
sheet.column_dimensions['Z'].width = 8.38
sheet.column_dimensions['AA'].width = 8.38
sheet.column_dimensions['AB'].width = 8.38
sheet.column_dimensions['AC'].width = 8.38
sheet.column_dimensions['AD'].width = 8.38
sheet.column_dimensions['AE'].width = 8.38
sheet.column_dimensions['AF'].width = 8.38
sheet.column_dimensions['AG'].width = 8.38
sheet.column_dimensions['AH'].width = 8.38
sheet.column_dimensions['AI'].width = 11.88
sheet.column_dimensions['AJ'].width = 11.88
sheet.column_dimensions['AK'].width = 11.88
sheet.column_dimensions['AL'].width = 11.88
sheet.column_dimensions['AM'].width = 11.88
sheet.column_dimensions['AN'].width = 11.88
sheet.column_dimensions['AO'].width = 11.88
for row in sheet:
    for cell in row:
        sheet[cell.coordinate].font = font

wb.save("report/学校录入模板.xlsx")
